from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from .views import statistical, users, specs, spus, skus, categories, images, permissions, orders, groups,admins
from rest_framework.routers import DefaultRouter

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/total_count/$', statistical.TotalView.as_view()),
    url(r'^statistical/day_increment/$', statistical.UserDayCountView.as_view()),
    url(r'^statistical/day_active/$', statistical.UserActiveCountView.as_view()),
    url(r'^statistical/day_orders/$', statistical.UserOrderCountView.as_view()),
    url(r'^statistical/month_increment/$', statistical.UserMonthCountView.as_view()),
    url(r'^statistical/goods_day_views/$', statistical.GoodsDayView.as_view()),
    url(r'^users/$', users.UserView.as_view()),
    url(r'^users/$', users.UserView.as_view()),
    url(r'^goods/simple/$', spus.SpuView.as_view()),
    url('^skus/categories/$', categories.Category3View.as_view()),
    # url('^skus/simple/$', skus.SKUSimpleView.as_view()),
    url('^goods/(?P<pk>\d+)/specs/$', specs.SpecBySpuView.as_view()),
    url('^permission/perms/$', permissions.PermissionView.as_view()),
    url('^permission/simple/$', permissions.PermissionSimpleView.as_view()),
]

router = DefaultRouter()
router.register('goods/specs', specs.SpecsModelViewSet, base_name='specs')  ## ??base_name
router.register('skus', skus.SkuView, base_name='skus')
router.register('skus/images/', images.ImageView, base_name='images')
router.register('orders', orders.OrderView, base_name='orders')
router.register('permission/groups', groups.GroupView, base_name='groups')
router.register('permission/admins', admins.AdminView, base_name='admins')
urlpatterns += router.urls
